package com.itheima.dubbo.mysql.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.itheima.commons.pojo.HuanxinUser;
import com.itheima.dubbo.interfaces.HuanxinUserApi;
import com.itheima.dubbo.mysql.mapper.HuanXinUserMapper;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @项目名称: tanhua-53
 * @包名: com.itheima.dubbo.mysql.impl
 * @作者: 李云飞
 * @日期: 2021-12-03
 */
@Service
public class HuanxinUserApiImpl implements HuanxinUserApi {

    @Autowired
    private HuanXinUserMapper hxUserMapper;

    @Override
    public HuanxinUser findHXUserByUserId(Long userId) {
        return hxUserMapper.selectOne(Wrappers.lambdaQuery(HuanxinUser.class)
            .eq(HuanxinUser::getUserId,userId)
        );
    }

    @Override
    public void addUser(HuanxinUser hxuser) {
        hxUserMapper.insert(hxuser);
    }
}
